Micron Document
Livres et Wikis | Archives | Info


Syntax Definition Formalism
layout: Wide Β· Narrow Β· Centered
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
The Syntax Definition Formalism (SDF) is a metasyntax used to define context-free grammars: that is, a formal way to describe formal languages. It can express the entire range of context-free grammars. Its current version is SDF3.cite-ref-1[1] A parser and parser generator for SDF specifications are provided as part of the free ASF+SDF Meta Environment. These operate using the SGLR (Scannerless GLR parser). An SDF parser outputs parse trees or, in the case of ambiguities, parse forests.

Contents

β€’ Overview
β€’ Examples
β€’ See also
β€’ References

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Overview

Features of SDF:

β€’ Supports the entire range of context-free languages
β€’ Allows modular syntax definitions (grammars can import subgrammars) which enables reuse
β€’ Supports annotations

Examples

The following example defines a simple Boolean expression syntax in SDF2:

module basic/Booleans
exports
sorts Boolean
context-free start-symbols Boolean
context-free syntax
"true" -> Boolean
"false" -> Boolean
lhs:Boolean "|" rhs:Boolean -> Boolean {left}
lhs:Boolean "&" rhs:Boolean -> Boolean {left}
"not" "(" Boolean ")" -> Boolean
"(" Boolean ")" -> Boolean
context-free priorities
Boolean "&" Boolean -> Boolean >
Boolean "|" Boolean -> Boolean

Program analysis and transformation systems using SDF

β€’ ASF+SDF Meta Environment provides SDF
β€’ RascalMPL
β€’ Spoofax/IMP [1]
β€’ Stratego/XT
β€’ Strafunski

See also

β€’ GNU bison
β€’ ANTLR

References

cite-note-11. ↑ sleconf.org

Further reading

β€’ A Quick Introduction to SDF, Visser, J. & Scheerder, J. (2000) CWI
β€’ The Syntax Definition Formalism SDF, Mark van den Brand, Paul Klint, Jurgen Vinju (2007) CWI

External links

β€’ Grammar Deployment Kit
β€’ SdfMetz computes metrics for SDF grammars
β€’ Download SDF from the ASF+SDF Meta Environment homepage